//
//  MyCollectionTableViewCell.m
//  LiuHeBao
//
//  Created by zr on 2018/8/24.
//  Copyright © 2018年 zr. All rights reserved.
//

#import "MyCollectionTableViewCell.h"

@interface MyCollectionTableViewCell ()

@property (nonatomic, weak)UILabel * contentLabel;
@property (nonatomic, weak)UILabel * infoLabel;
@property (nonatomic, weak)UIView * lineView;

@end

@implementation MyCollectionTableViewCell


- (void)setModel:(MyCollectionModel *)model{
    
    _model = model;
    
    self.contentLabel.text = model.title;
}


- (void)setMsgModel:(MyMessageModel *)msgModel{
    
    _msgModel = msgModel;
    
    self.contentLabel.text = msgModel.title;
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}



- (void)setupUI{
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = [UIColor whiteColor];

    
    UILabel * contentLabel = [UILabel new];
    
    contentLabel.textColor = BLACK_COLOR;
    contentLabel.font = [UIFont systemFontOfSize:14 * SCREENH6];
    contentLabel.numberOfLines = 2;
    contentLabel.text = @"";
    
    self.contentLabel = contentLabel;
    
    [self.contentView addSubview:self.contentLabel];
    
    
    UILabel * infoLabel = [UILabel new];
    
    infoLabel.textColor = MAINCOLOR;
    infoLabel.font = [UIFont systemFontOfSize:13 * SCREENH6];
    infoLabel.text = @"查看详情";
    
    self.infoLabel = infoLabel;
    
    [self.contentView addSubview:self.infoLabel];
    
    
    UIView * lineView = [UIView new];
    
    lineView.backgroundColor = ColorWithRGB(0xe6e6e6);//[UIColor lightGrayColor];
    
    self.lineView = lineView;
    
    [self.contentView addSubview:self.lineView];
    
}

- (void)layoutSubviews{

    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.contentView).offset(15 * SCREENH6);
        make.trailing.mas_equalTo(self.contentView).offset(-15 * SCREENH6);
        make.top.mas_equalTo(self.contentView).offset(10 * SCREENH6);
    }];
    
    [self.infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.mas_equalTo(self.contentView).offset(-15 * SCREENH6);
        make.top.mas_equalTo(self.contentLabel.mas_bottom).offset(8 * SCREENH6);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.contentView).offset(15 * SCREENH6);
        make.trailing.mas_equalTo(self.contentView).offset(-15 * SCREENH6);
        make.height.mas_equalTo(1 * SCREENH6);
        make.bottom.mas_equalTo(self.contentView);
    }];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
